package com.example.libraryapp.network.net;

import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.observers.DisposableObserver;

/**
 * Observables 管理类
 * @author 伍凯铭
 * @since 2020/2/27
 */
public class RxManager {
    private CompositeDisposable compositeDisposable;

    public RxManager() {
        this.compositeDisposable = new CompositeDisposable();
    }

    /**
     * 添加observer
     * @param observer
     */
    public void addObserver(DisposableObserver observer){
        if(observer != null){
            compositeDisposable.add(observer);
        }
    }

    public void clear(){
        compositeDisposable.dispose();
    }

}
